 <{extends file="<{$tempdir}>/public/wxsite.html"}>  
<{block name=extendcss}> 
    <link rel="stylesheet"  href="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/css/recharge.css">

<{/block}>
 <{block name=extendjs}>  
   <script src="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/js/template.min.js"></script>    
<{/block}>
<{block name=myScrolljs}>
<script> 
		var myScroll;
function loaded() {
	myScroll = new iScroll('wrapper', {
		useTransform: false,
		onBeforeScrollStart: function (e) {
			var target = e.target;
			while (target.nodeType != 1) target = target.parentNode;

			if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA')
				e.preventDefault();
		}
	});
}
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); 
document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);
</script>
<{/block}>
<{block name=sitetitle}><{$sitename}><{/block}>
<{block name=hearnav}>
<div class="toptitCon">
 <div class="toptitBox">
  <div class="toptitL"><i></i></div>
  <div class="toptitC"><h3>余额</h3></div>
  <div class="toptitR"  onclick="dolink('<{ofunc type=url link="/wxsite/costlog"}>');" ><h3>余额明细</h3></div>
 </div>
</div>
<div class="balRechTopCon">
			<i></i>
			<span class="balRechTopFon1">余额</span>
			<span class="balRechTopFon2">￥<b><{$member['cost']}></b></span>
		</div>
<div class="balRechTab">
			<ul>
				<li class="bareTaA">充值</li>
				<li  onclick="dolink('<{ofunc type=url link="/wxsite/paybangcard"}>');" >充值卡充值</li>
			</ul>
		</div>
<{/block}>
<{block name=blockcontent}>  
 <div id="wrapper" style="top:178px; bottom:55px;">
	<div id="scroller">
	
	<div class="balRechInp">
			<input  style="width:90%;" type="number" id="Sum" name="Sum"  placeholder="手动输入充值金额" />
		</div>
<{if !empty($rechargelist) }>		

		
 <div class="balRechCho">
			<ul>
			<{foreach from=$rechargelist item=items }>
				<li class="recharge_<{$items['cost']}>" dataid="<{$items['id']}>" cost="<{$items['cost']}>" is_sendcost="<{$items['is_sendcost']}>" sendcost="<{$items['sendcost']}>" is_sendjuan="<{$items['is_sendjuan']}>" sendjuancost="<{$items['sendjuancost']}>" >
					<span class="baRspFon1"><b>￥</b><{$items['cost']}></span>
					<span class="baRspFon2">送<{$items['totalsendcost']}>元</span>
				</li>
			<{/foreach}>	 
			</ul>
		</div>
	
		<div  style="display:none;" class="balRechProm"></div>

<{/if}>		 
 
  <div style="height:10px;"></div>
</div>		 
</div>	 
<script>
var biaoqianval = false;	
function bqzhi(){
	biaoqianval  = false;
}
$("#Sum").bind('focus',function(){
	if( $('.balRechCho li.baRliaA').length > 0 ){
		Tmsg("您已选择快捷充值，请取消后在输入");
		$("#Sum").val('');
	}
});
$("#Sum").bind('keyup',function(){

if(biaoqianval == false){
		biaoqianval  = true;
		setTimeout("bqzhi()", 500 ); 
	var costval = Number( $("#Sum").val() ).toFixed(2);
	if( costval > 0  ){
		var rbj = ".balRechCho li";
		var rechargelength = $(rbj).length;
		for( i=0;i<rechargelength;i++ ){
			
			var cost =  $(rbj).eq(i).attr('cost');
		 
			if( costval == cost ){
 				
				var is_sendcost = $(rbj).eq(i).attr('is_sendcost');
				var sendcost = $(rbj).eq(i).attr('sendcost');
				var is_sendjuan = $(rbj).eq(i).attr('is_sendjuan');
				var sendjuancost = $(rbj).eq(i).attr('sendjuancost');
				$('.balRechProm').show();
				$('.balRechProm').html('');
				$('.balRechProm').html('充值'+cost+'元赠送');
				if( is_sendcost == 1 ){
					$('.balRechProm').append(''+sendcost+'元');
				}
				if( is_sendcost == 1 && is_sendjuan == 1 ){
					$('.balRechProm').append('+');
				}
				if( is_sendjuan == 1 ){
					$('.balRechProm').append(''+sendjuancost+'优惠券');
				}
				 
				myScroll.refresh();
				
				
				break;
			}else{
 			 
					 $('.balRechProm').show();
					 $('.balRechProm').html('');
					 $('.balRechProm').html('无优惠');
				 
			}
			
			
		}
 		return false;
	}else{
 		if(  costval == '0.00' ){
				 
				$('.balRechProm').hide();
					$('.balRechProm').html('');
			
		} 
		
				
	}
 myScroll.refresh();
			
}			
	
 });

	$(".balRechCho li").bind('click',function(){ 
		if(lockclick()){
 		if( $("#Sum").val() > 0 ){
			Tmsg("您已手动输入充值金额，请清空后在选择！");
		}else{
		
			var is_has  = $(this).hasClass('baRliaA');
  			$(".balRechCho li").removeClass('baRliaA');
 			
			var cost = $(this).attr('cost');
			var is_sendcost = $(this).attr('is_sendcost');
			var sendcost = $(this).attr('sendcost');
			var is_sendjuan = $(this).attr('is_sendjuan');
			var sendjuancost = $(this).attr('sendjuancost');
			$('.balRechProm').show();
			$('.balRechProm').html('');
			$('.balRechProm').html('充值'+cost+'元赠送');
			if( is_sendcost == 1 ){
				$('.balRechProm').append(''+sendcost+'元');
			}
			if( is_sendcost == 1 && is_sendjuan == 1 ){
				$('.balRechProm').append('+');
			}
			if( is_sendjuan == 1 ){
				$('.balRechProm').append(''+sendjuancost+'优惠券');
			}
			
			if(is_has){
				$(this).removeClass('baRliaA');
				$(".balRechProm").hide();
			}else{
				$(this).addClass('baRliaA');
			}
			
			myScroll.refresh();
		}	
		} 
	});

	function nextpay(){
		
		var sj = $('.balRechCho li.baRliaA').attr('dataid');
		if( sj == undefined ){
			var cost = $('#Sum').val();
			//if( $('#Sum').val() <= 0){
			//	Tmsg('充值金额不能小于10！');
			//} else{
				
			//}
			
			
		}else{
			var cost = $('.balRechCho li.baRliaA').attr('cost');
			 
		}
		var newlink = '<{ofunc type=url link="/wxsite/subbalancepay/cost/@cost@"}>';
		var showlink = newlink.replace('@cost@',cost);
 		location.href = showlink ;  
		
 			
		
		
	} 
	

 </script>
<{/block}>
<{block name=footer}>
<div style=" position:fixed; z-index:999999; bottom:10px; width:100%; ">
<div style="margin-top:10px;" class="intexchabutt"><input type="button" value="立即充值" id="nextpay" onclick="nextpay();"  class="intexbg1"></div>
</div>
<{/block}>